//
//  MyobligationInformationCell.m
//  spotrs
//
//  Created by sky on 16/5/18.
//  Copyright © 2016年 TZ. All rights reserved.
//

#import "MyobligationInformationCell.h"

@implementation MyobligationInformationCell
{
    UILabel *_name;
    UILabel *_adress;
    UILabel *_description;
    UILabel *_leavel;
    UIImageView *_headview;
    UIImageView *_sexvi;
    
    UILabel *_titlelbl;
    UILabel *_adresslbl;
    UILabel *_endtimelbl;
    UILabel *_expmoneylbl;
    UILabel *_methodlbl;
    UILabel *_asklbl;
    UILabel *_actleavelbl;
}


- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        [self buildLayout];
    }
    return self;
}

-(void)buildLayout{
    UIView *bgview = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 90)];
    bgview.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:bgview];
    
    UIView *secbgview = [[UIView alloc]initWithFrame:CGRectMake(0, 100, SCREEN_WIDTH, 45 *7)];
    secbgview.backgroundColor = [UIColor whiteColor];
    [self.contentView addSubview:secbgview];
    
    for (int i = 0 ; i < 8; i ++) {
        [self makeLinewithRect:CGRectMake(0, i * 44.5 + i * .5, SCREEN_WIDTH, .5) Color:[LCCommon getColor:@"ebebeb"] addview:secbgview];
    }
    
    _headview = [[UIImageView alloc]initWithFrame:CGRectMake(15, 10, 70, 70)];
    _headview.backgroundColor = [LCCommon getColor:@"ebebeb"];
    [bgview addSubview:_headview];
    
    _name = [self LabelWithRect:CGRectMake(_headview.frame.origin.x + _headview.frame.size.width + 10, 18, SCREEN_WIDTH, 15) textColor:[UIColor blackColor] textstr:@"特么闹心" textfont:15 textstyle:NSTextAlignmentLeft];
    [bgview addSubview:_name];
    
    
    _sexvi = [[UIImageView alloc]initWithFrame:CGRectMake(_name.frame.origin.x, _name.frame.origin.y + 15 + 10, 10, 10)];
    _sexvi.backgroundColor = [UIColor orangeColor];
    [bgview addSubview:_sexvi];
    
    _leavel = [self LabelWithRect:CGRectMake(_sexvi.frame.origin.x + 10, _sexvi.frame.origin.y, 10, 10) textColor:[UIColor whiteColor] textstr:@"0" textfont:10 textstyle:NSTextAlignmentCenter];
    _leavel.backgroundColor = [UIColor orangeColor];
    [bgview addSubview:_leavel];
    
    _adress = [self LabelWithRect:CGRectMake(_leavel.frame.origin.x + 10 + 10, _leavel.frame.origin.y, SCREEN_WIDTH, 10) textColor:[LCCommon getColor:@"999999"] textstr:@"北京" textfont:10 textstyle:NSTextAlignmentLeft];
    [bgview addSubview:_adress];
    
    _description = [self LabelWithRect:CGRectMake(_sexvi.frame.origin.x, _sexvi.frame.origin.y + 10 + 10, SCREEN_WIDTH, 10) textColor:[LCCommon getColor:@"999999"] textstr:@"=。=。=。=。=！！！" textfont:10 textstyle:NSTextAlignmentLeft];
    [bgview addSubview:_description];
    
    UIImageView *iphone = [[UIImageView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH - 15 -40, 45 - 20, 40, 40)];
    iphone.backgroundColor = [UIColor orangeColor];
    [bgview addSubview:iphone];
    
    _titlelbl = [self LabelWithRect:CGRectMake(15, 15, SCREEN_WIDTH, 15) textColor:[UIColor blackColor] textstr:@"北京市昌平区" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:_titlelbl];
    
    UILabel *dizhi = [self LabelWithRect:CGRectMake(15, _titlelbl.frame.origin.y + 45, 15 * 2 + 15, 15) textColor:[UIColor blackColor] textstr:@"地址 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:dizhi];
    
    UILabel *jiezhi = [self LabelWithRect:CGRectMake(15, dizhi.frame.origin.y + 45, 15 * 4 + 15, 15) textColor:[UIColor blackColor] textstr:@"报名截止 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:jiezhi];
    
    UILabel *feiyong = [self LabelWithRect:CGRectMake(15, jiezhi.frame.origin.y + 45, 15 * 2 + 15, 15) textColor:[UIColor blackColor] textstr:@"费用 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:feiyong];
    
    UILabel *fangshi = [self LabelWithRect:CGRectMake(15, feiyong.frame.origin.y + 45, 15 * 4 + 15, 15) textColor:[UIColor blackColor] textstr:@"活动方式 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:fangshi];
    
    UILabel *yaoqiu = [self LabelWithRect:CGRectMake(15, fangshi.frame.origin.y + 45, 15 * 2 + 15, 15) textColor:[UIColor blackColor] textstr:@"要求 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:yaoqiu];
    
    UILabel *jiebie = [self LabelWithRect:CGRectMake(15, yaoqiu.frame.origin.y + 45, 15 * 4 + 15, 15) textColor:[UIColor blackColor] textstr:@"活动级别 :" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:jiebie];
    
    
    _adresslbl = [self LabelWithRect:CGRectMake(dizhi.frame.origin.x + dizhi.frame.size.width , dizhi.frame.origin.y, SCREEN_WIDTH - (dizhi.frame.origin.x + dizhi.frame.size.width), 15) textColor:[UIColor blackColor] textstr:@"擦汗奶瓶" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:_adresslbl];
    
    _endtimelbl = [self LabelWithRect:CGRectMake(jiezhi.frame.origin.x + jiezhi.frame.size.width, jiezhi.frame.origin.y, SCREEN_WIDTH - (jiezhi.frame.origin.x + jiezhi.frame.size.width), 15) textColor:[UIColor blackColor] textstr:@"2015-4-4" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:_endtimelbl];
    
    _expmoneylbl = [self LabelWithRect:CGRectMake(feiyong.frame.origin.x + feiyong.frame.size.width, feiyong.frame.origin.y , SCREEN_WIDTH - (feiyong.frame.origin.x + feiyong.frame.size.width), 15) textColor:[UIColor blackColor] textstr:@"AA制" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:_expmoneylbl];
    
    _methodlbl = [self LabelWithRect:CGRectMake(fangshi.frame.origin.x + fangshi.frame.size.width, fangshi.frame.origin.y , SCREEN_WIDTH - (fangshi.frame.origin.x + fangshi.frame.size.width), 15) textColor:[UIColor blackColor] textstr:@"打打打" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:_methodlbl];
    
    _asklbl = [self LabelWithRect:CGRectMake(yaoqiu.frame.origin.x + yaoqiu.frame.size.width, yaoqiu.frame.origin.y,SCREEN_WIDTH - (yaoqiu.frame.origin.x + yaoqiu.frame.size.width), 15) textColor:[UIColor blackColor] textstr:@"没要求" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:_asklbl];
    
    _actleavelbl = [self LabelWithRect:CGRectMake(jiebie.frame.origin.x + jiebie.frame.size.width, jiebie.frame.origin.y , SCREEN_WIDTH - (jiebie.frame.origin.x + jiebie.frame.size.width), 15) textColor:[UIColor blackColor] textstr:@"一级" textfont:15 textstyle:NSTextAlignmentLeft];
    [secbgview addSubview:_actleavelbl];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

-(UIView *)makeLinewithRect:(CGRect)rect Color:(UIColor *)color addview:(UIView *)vi{
    UIView *line = [[UIView alloc]initWithFrame:rect];
    line.backgroundColor = color;
    [vi addSubview:line];
    return line;
}


-(UILabel *)LabelWithRect:(CGRect)rect textColor:(UIColor *)color textstr:(NSString *)str textfont:(int)font textstyle:(NSTextAlignment)aligment{
    UILabel *label = [[UILabel alloc] initWithFrame:rect];
    label.textColor = color;
    label.text = str;
    label.font = [UIFont systemFontOfSize:font];
    label.textAlignment = aligment;
    label.numberOfLines = 0;
    return label;
}



@end
